package cn.liccshop.sys.utils;

import org.apache.commons.lang3.StringUtils;

import java.util.Random;

/**
 * @author LiCC
 * @program LiCCShop
 * @description 随机数创建
 * @since 2019-05-09-21:55
 */
public class RandomNumberCode {
    /**
     * 生成四位的短信随机验证码
     * @return
     */
    public static String getVerCode(){
        Random random = new Random();
        String verCode = StringUtils.substring(String.valueOf(random.nextInt()), 1, 5);
        return verCode;
    }
    /**
     * 生成七位的随机号
     * @return
     */
    public static String getUserCode(){
        Random random = new Random();
        String verCode = StringUtils.substring(String.valueOf(random.nextInt()), 1, 8);
        return verCode;
    }

    /**
     * 生产订单号
     * @return
     */
    public static String getOrderSN(){
        Random random = new Random();
        String orderSN = System.currentTimeMillis()+""+StringUtils.substring(String.valueOf(random.nextInt()), 1, 5);
        return orderSN;
    }
    /**
     * 生产交易编号
     * @return
     */
    public static String getTransactionSN(){
        Random random = new Random();
        String orderSN = System.currentTimeMillis()+""+StringUtils.substring(String.valueOf(random.nextInt()), 1, 5);
        return orderSN;
    }
}
